<template>
  <div>
    <editForm
      :formConfig="basicConfig"
      ref="basicForm"
      :formData="formData"
    ></editForm>
  </div>
</template>

<script>
export default {
  props: {
    allInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
    state: {
      type: Number,
    },
  },
  data() {
    return {
      show: false,
      disabled: false,
      basicConfig: {
        labelWidth: "120px",
        itemArr: [
          {
            label: "计划编号",
            prop: "planCode",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "所属单位",
            prop: "belongDeptName",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "巡视单位",
            prop: "patrolDeptName",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "人员安排方式",
            prop: "arrangement",
            type: "select",
            isHide: false,
            disabled: true,
            span: 6,
            selectOption: this.$store.getters.dirtData("staffing_way"),
          },
          {
            label: "巡视人员",
            prop: "workerName",
            type: "text",
            disabled: true,
            isHide: false,
            span: 6,
          },
          {
            label: "值班地点",
            prop: "locationName",
            type: "text",
            isHide: false,
            disabled: true,
            span: 6,
          },
          {
            label: "签到方式",
            prop: "arriveWay",
            type: "select",
            disabled: true,
            span: 6,
            selectOption: this.$store.getters.dirtData("arrive_way"),
          },
          {
            label: "巡视类别",
            prop: "patrolType",
            type: "select",
            disabled: true,
            span: 6,
            selectOption: this.$store.getters.dirtData("patrol_way"),
          },
          {
            label: "计划开始时间",
            prop: "planStartTime",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "计划结束时间",
            prop: "planEndTime",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "实际开始时间",
            prop: "factStartTime",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "实际结束时间",
            prop: "factEndTime",
            type: "text",
            disabled: true,
            span: 6,
          },
          {
            label: "准备工作",
            prop: "prepare",
            type: "textarea",
            rows: 4,
            disabled: true,
            span: 12,
          },
          {
            label: "备注",
            prop: "remarks",
            type: "textarea",
            disabled: true,
            rows: 4,
            span: 12,
          },
          {
            label: "巡视签名",
            prop: "signName",
            type: "text",
            disabled: true,
            span: 6,
          },
        ],
      },
      formData: {},
    };
  },
  created() {},
  watch: {
    allInfo: {
      handler(val) {
        if (val.userPos) {
          val.workerName = val.userPos.map((item) => item.workerName).join(",");
          val.signName = val.signBeanList ? val.signBeanList.map((item) => item.signerName).join(",") : "";
        }
        this.formData = val;
        this.init(val);
      },
    },
  },
  methods: {
    //初始化函数
    init(val) {},
    async getBasicInfo() {
      let formData = await this.$refs.basicForm.getFormData();
      return formData;
    },
  },
};
</script>

<style lang="less" scoped>
.upload-file {
  margin-left: 70px;
  text-align: left;
  display: flex;
  span {
    margin-right: 10px;
  }
}
</style>